Fix GDB core dump test hang caused by deferred error response#22
Merged
Conversation
Add TestMain with a -dap-log flag that enables DAP protocol and tool-level logging during test runs. When set to a directory path, each test gets its own .protocol.log and .tool.log files. Helper functions dapLogArgs() and dumpDAPLogs() wire the logging into test debug sessions and dump logs on test failure.
GDB's native DAP defers launch/attach processing until after configurationDone. When GDB rejects an attach request (e.g. core dump on GDB < 18 which lacks coreFile support), the error response arrives in the post-configurationDone wait loop where it was silently skipped, causing an infinite hang. Track the launch/attach request sequence number and check for matching error responses in the StoppedEvent and breakpoint wait loops. This turns a 120s timeout into a fast error (~0.3s). Also: - Revert incorrect core dump protocol (attach + coreFile is correct, not launch + core) - Remove mandatory path requirement for GDB core mode (GDB 18+ can auto-detect executable from core file) - Add os.Chmod guard in TestGDBCoreDump to prevent false success - Skip GDB core dump tests on GDB < 18 with informative message
- Restore early validation for non-GDB core mode requiring path param - Use -1 sentinel for launchSeq so unset value can't match a real response - Add comments clarifying that successful deferred responses are intentional no-ops - Restore "main" assertion in TestGDBCoreDumpWithoutPath - Extract skipIfGDBLacksCoreFileSupport helper to reduce duplication
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GDB's native DAP defers launch/attach processing until after
configurationDone. When GDB rejects an attach request (e.g. core
dump on GDB < 18 which lacks coreFile support), the error response
arrives in the post-configurationDone wait loop where it was silently
skipped, causing an infinite hang.
Track the launch/attach request sequence number and check for matching
error responses in the StoppedEvent and breakpoint wait loops. This
turns a 120s timeout into a fast error (~0.3s).